<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>FOG-无拘才自在</title>
		<link rel="stylesheet" type="text/css" href="../css/login.css" />
	</head>
	<body>
		
<section class="container">
		<nav class="nav">
			<div class="nav_logo">FOG</div>

			<div class="nav_content">
				<div class="nav_content_text">
					<a href="../index.html">首页</a>
				</div>

				<div class="nav_content_text">
					<a href="login.html">登录</a>
				</div>
					
				<div class="nav_content_text">
					<a href="../Admin/authentication.html">控制台</a>
				</div>
			</div>
		</nav>
		
		
		<header>
			<div class="left">
				融以真心
				<br>&nbsp;&nbsp;
				写下你的第一笔。
			</div>
		</header>
		
		
		<div class="right">	
			<form id="registerForm">
				
				<div class="title">注&nbsp;册</div>
				
            	<div class="form-item">
                	<label for="username">账&nbsp;号</label>
                	<input type="text" id="username" name="username" required>
            	</div>
            
            	<div class="form-item">
                	<label for="password">密&nbsp;码</label>
                	<input type="password" id="password" name="password" required>
            	</div>
            	
            	<div class="form-item">
                	<label for="email">邮&nbsp;箱</label>
                	<input type="email" id="email" name="email" required>
            	</div>
   
   
            	<button type="submit" class="submit-btn">注&nbsp;册</button>
            
            	<div class="toRegist">已有账号？<a href="login.html">去登录</a></div>

			</form>
        	
		</div>
</section>

	<script>
		// 获取表单元素
		const registerForm = document.getElementById('registerForm');
		
		// 监听表单提交事件
		registerForm.addEventListener('submit', function(e) {
			// 阻止表单默认提交行为
			e.preventDefault();
			
			// 获取输入的注册信息
			const username = document.getElementById('username').value;
			const password = document.getElementById('password').value;
			const email = document.getElementById('email').value;
			
			// 简单的表单验证
			if (!username || !password || !email) {
				alert('请填写完整的注册信息');
				return;
			}
			
			// 邮箱格式验证
			const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
			if (!emailRegex.test(email)) {
				alert('请输入有效的邮箱地址');
				return;
			}
			
			// 实际项目中，这里会发送注册请求到后端
			// 这里使用模拟注册成功
			// 显示注册成功提示
			alert('注册成功请登录');
			
			// 延迟跳转，让用户看到提示信息
			setTimeout(() => {
				// 跳转到登录页面
				window.location.href = 'login.html';
			}, 1000); // 1秒后跳转
		});
	</script>
	</body>
</html>
